HACKER Q&A
📣 pannow

Build text-only browser tool with JavaScript/Node.js?


We are living abroad and cellular Internet here is not cheap. Every MB counts! Web pages these days have so many useless things to load.

Last time I used Opera mini with extreme mode to save data. But now, there is no more Opera Mini on iPad. I found some available tools like text.brow.sh (offline now), and another tool (not support UTF-8). I don't own a computer now, only have tablet devices. Thus, I think I may need to build a simple pure text only browser tool (Javascript/PHP) and put it on https://glitch.com or https://herokuapp.com or github page. Then I just simply use the browser on tablet visit my web page and enter the web I need to read with pure text only.

The idea now is something like:

``` text = await fetch("google.com").then(res => res.txt())

``` However, "fetch" will use our cellular Internet data to fetch the page before processing it to text.

Thanks for any advices/solutions.

May you all be well and happy!


  👤 pannow Accepted Answer ✓
I just came up with this PHP version:

    
    
    
    
      
      
      Pure Text Browser
    
    
    
      
getText(); $text = preg_replace("/\n/", "
", $text); $pattern = '/(\[)(http.*?)(\])/i'; $replacement = '$1$2$3'; $text = preg_replace($pattern, $replacement, $text); echo $text; } ?>